package com.woniuxy.movie.order.client;


import com.woniuxy.movie.commons.core.model.Result;
import com.woniuxy.movie.order.client.dto.SessionInfoDto;
import com.woniuxy.movie.order.client.dto.TicketInfoDto;
import com.woniuxy.movie.order.client.form.ProductForm;
import com.woniuxy.movie.order.dto.ProductInfoDto;
import com.woniuxy.movie.order.form.ticket.TicketSaledForm;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

@FeignClient(name = "product-service",path = "/product")
public interface ProductClient {

    @GetMapping("/product/byId")
    public Result<ProductInfoDto> byId(@RequestParam("id")Integer id);

    @GetMapping("/product/byId1")
    public Result<ProductInfoDto> byId1(@SpringQueryMap ProductForm pf);

    @GetMapping("/product/byId2")
    public Result<ProductInfoDto> byId2(@RequestBody ProductForm pf);

    /**
     * 通过多ID查询票务信息
     * @param ids
     * @return
     */
    @PostMapping("/productTicket/byIds.api")
    public Result<List<TicketInfoDto>> byTicketIds(@RequestBody Set<Integer> ids);

    /**
     * 通过ID查询场次信息
     * @param id
     * @return
     */
    @GetMapping("/productSession/byId/{id}.api")
    public Result<SessionInfoDto> bySessionId(@PathVariable("id") Integer id);

    /**
     * 修改场次信息
     * @param sid
     * @return
     */
    @PostMapping("/productSession/save.api")
    public Result<Boolean> saveSession(@RequestBody SessionInfoDto sid);

    /**
     * 通过多个ID修改票务状态为锁定状态
     * @param ids
     * @return
     */
    @PostMapping("/productTicket/saveLock.api")
    public Result<Integer> saveTicketLock(@RequestBody Set<Integer> ids);

    /**
     * 通过多个ID修改票务状态为已售状态以及其它信息
     * @param form
     * @return
     */
    @PostMapping("/productTicket/saveSaled.api")
    public Result<Integer> saveTicketSaled(@RequestBody TicketSaledForm form);

    /**
     * 通过多个ID修改票务状态为正常待售状态
     * @param ids
     * @return
     */
    @PostMapping("/productTicket/saveNormal.api")
    public Result<Integer> saveTicketNormal(@RequestBody Set<Integer> ids);

}
